package app.game.common;

import puri01.game.GameControl;
import puri01.game.GameControlGroup;
import puri01.game.GamePlatformInfo;
import android.graphics.Canvas;
import android.graphics.Paint;
import app.game.resource.ResourceBackground;

public class Background extends GameControl {

	private static final int _BACKROUND_SPEED_SLOW = 25;
	private static final int _BACKROUND_SPEED_FAST = 50;

	public Background(GameControlGroup gameControlGroup) {
		super(gameControlGroup);
		
		_Background_A.setBitmap(ResourceBackground.getInstance().getBackground_A());
		_Background_A.setSpeed(_BACKROUND_SPEED_SLOW);

		_Background_B.setBitmap(ResourceBackground.getInstance().getBackground_B());
		_Background_B.setSpeed(_BACKROUND_SPEED_FAST);
	}

	private Canvas _Canvas = null;
	private Paint _Paint = null;
	
	private BackgroundImage _Background_A = new BackgroundImage();
	private BackgroundImage _Background_B = new BackgroundImage();
	
	@Override
	protected void onStart(GamePlatformInfo platformInfo) {
		_Canvas = platformInfo.getCanvas();
		_Paint = platformInfo.getPaint();
	}
	
	@Override
	protected void onDraw(GamePlatformInfo platformInfo) {
		long tick = platformInfo.getTick();
		
		_Background_A.Draw(_Canvas, _Paint, tick);
		_Background_B.Draw(_Canvas, _Paint, tick);
	}
	
}
